# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Offer do
  @moduledoc """
  Represents an offer made to resellers for purchase. An offer is associated with a Sku, has a plan for payment, a price, and defines the constraints for buying.

  ## Attributes

  *   `constraints` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Constraints.t`, *default:* `nil`) - Constraints on transacting the Offer.
  *   `dealCode` (*type:* `String.t`, *default:* `nil`) - The deal code of the offer to get a special promotion or discount.
  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. End of the Offer validity time.
  *   `marketingInfo` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1MarketingInfo.t`, *default:* `nil`) - Marketing information for the Offer.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Resource Name of the Offer. Format: accounts/{account_id}/offers/{offer_id}
  *   `parameterDefinitions` (*type:* `list(GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1ParameterDefinition.t)`, *default:* `nil`) - Parameters required to use current Offer to purchase.
  *   `plan` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Plan.t`, *default:* `nil`) - Describes the payment plan for the Offer.
  *   `priceByResources` (*type:* `list(GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1PriceByResource.t)`, *default:* `nil`) - Price for each monetizable resource type.
  *   `sku` (*type:* `GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Sku.t`, *default:* `nil`) - SKU the offer is associated with.
  *   `startTime` (*type:* `DateTime.t`, *default:* `nil`) - Start of the Offer validity time.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :constraints =>
            GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Constraints.t() | nil,
          :dealCode => String.t() | nil,
          :endTime => DateTime.t() | nil,
          :marketingInfo =>
            GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1MarketingInfo.t() | nil,
          :name => String.t() | nil,
          :parameterDefinitions =>
            list(GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1ParameterDefinition.t())
            | nil,
          :plan => GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Plan.t() | nil,
          :priceByResources =>
            list(GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1PriceByResource.t()) | nil,
          :sku => GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Sku.t() | nil,
          :startTime => DateTime.t() | nil
        }

  field(:constraints, as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Constraints)
  field(:dealCode)
  field(:endTime, as: DateTime)
  field(:marketingInfo, as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1MarketingInfo)
  field(:name)

  field(:parameterDefinitions,
    as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1ParameterDefinition,
    type: :list
  )

  field(:plan, as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Plan)

  field(:priceByResources,
    as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1PriceByResource,
    type: :list
  )

  field(:sku, as: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Sku)
  field(:startTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Offer do
  def decode(value, options) do
    GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Offer.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudChannel.V1.Model.GoogleCloudChannelV1Offer do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
